package br.com.ema.maze.components;

import java.util.ArrayList;
import java.util.List;

import br.com.ema.maze.listeners.MazeComponentContentChangeListener;

/**
 * @author Emanuel Cruz Rodrigues -> emanuelcruzrodrigues@gmail.com
 *
 */
public abstract class MazeComponent {
	
	private List<MazeComponentContentChangeListener> contentChangeListeners;
	
	public MazeComponent() {
		contentChangeListeners = new ArrayList<MazeComponentContentChangeListener>();
	}

	public void addContentListener(MazeComponentContentChangeListener listener){
		contentChangeListeners.add(listener);
	}
	
	public void callContentChangeListeners(){
		for (MazeComponentContentChangeListener listener : contentChangeListeners) {
			listener.contentChanged(this);
		}
	}
	
}
